import http from "@/api";
import { ResPage } from "@/api/interface";
import {
ApiTripItemCreate,
ApiTripItemDelete,
ApiTripItemSearch,
ApiTripItemUpdate,
ApiTripItemExport,
ApiTripItemImport,
ApiTripItemImportTemplateFile,
} from "@/api/apis/trip_item";
import { ReqSearch } from "@/api/interface/Search/ReqSearch";
import { dtoTripItemCreate, dtoTripItemDelete, dtoTripItemInfo, dtoTripItemUpdate } from "@/api/dbdto/dtoTripItem";

export const requestTripItemCreate = (params: dtoTripItemCreate) => {
return http.post(ApiTripItemCreate, params);
};

export const requestTripItemSearch = (params: ReqSearch) => {
return http.post<ResPage<dtoTripItemInfo>>(ApiTripItemSearch, params);
};

export const requestTripItemUpdate = (params: dtoTripItemUpdate) => {
return http.post(ApiTripItemUpdate, params);
};

export const requestTripItemDelete = (params: dtoTripItemDelete) => {
return http.post(ApiTripItemDelete, params);
};

//导入数据
export const requestTripItemImport = (params: FormData) => {
return http.post(ApiTripItemImport, params);
};

//获取导入数据文件模板
export const requestTripItemTemplateFile = (params = {}) => {
//,记得是download方法， md，使用post搞了半天
return http.download(ApiTripItemImportTemplateFile, {});
};

//导出数据
export const requestTripItemExport = (params: ReqSearch) => {
return http.download(ApiTripItemExport, params);
};
